/**
* All Rights Reserved , Copyright (C) 2021 , 青岛鼎信通讯股份有限公司
*
* MmsBaseConfigServiceAuto
* 意见反馈基础配置表
*
* 修改纪录
* 2021-10-29 版本：1.0 zhangqianbo 创建。
* @version 版本：1.0
* @author 作者：zhangqianbo
* 创建日期：2021-10-29
*/

package com.topscomm.mms.service.impl.auto;

import javax.annotation.Resource;
import com.topscomm.basic.IBasicDao;
import com.topscomm.pub.util.StringBufferProxy;
import com.topscomm.tap.common.DatacodeCache;
import java.util.Map;
import com.topscomm.mms.*;
import com.topscomm.mms.pojo.MmsBaseConfigEntity;
import com.topscomm.mms.dao.IMmsBaseConfigDao;


public class MmsBaseConfigServiceAuto extends MmsService<MmsBaseConfigEntity,IMmsBaseConfigDao> {

	/**
	 * @author: zhangqianbo
	 * @date: 2021-10-29
	 * @param mapRow
	 * @description:设置字段显示值
	 * @modify:
	 */
	@Override
	public void setDispFields(Map<String, Object> mapRow, DatacodeCache datacodeCache) {
		String temp;
		if (mapRow.get("servicetype") != null) {
			temp = mapRow.get("servicetype").toString();
			mapRow.put("dispservicetype", datacodeCache.getValueDynamic("FeedbackServiceType", temp, "code", "name"));
		}
		if (mapRow.get("belongbusiness") != null) {
			temp = mapRow.get("belongbusiness").toString();
			mapRow.put("disbelongbusiness", datacodeCache.getValueDynamic("BusinessTypeList", temp, "code", "name"));
		}
		if (mapRow.get("system") != null) {
			temp = mapRow.get("system").toString();
			mapRow.put("dissystem", datacodeCache.getValueDynamic("FeedbackSystem", temp, "code", "name"));
		}
		if (mapRow.get("feedbacktype") != null) {
			temp = mapRow.get("feedbacktype").toString();
			String[] tempArray = temp.split(",");
			StringBufferProxy sbp = new StringBufferProxy();
			for(String a:tempArray) {
				sbp.appendSingle("{0},",datacodeCache.getValueDynamic("FeedbackType", a, "code", "name"));
			}
			// 将sbp里封装得sb字符串拿出来，放到tmp，让前端能取到值
			StringBuffer tmp = sbp.getSb();
			if(tmp.length()>0) {
				mapRow.put("disfeedbacktype",tmp.substring(0,sbp.length()-1));
			}
		}
		if (mapRow.get("enabled") != null) {
			temp = mapRow.get("enabled").toString();
			mapRow.put("dispenabled", datacodeCache.getValueDynamic("CboYesNo", temp, "code", "name"));
		}
	}

	@Override
	@Resource(name = "mmsBaseConfigDao")
	public void setDao(IBasicDao<MmsBaseConfigEntity> dao) {
		super.setDao(dao);
	}
}
